package com.cccyy.date;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class dateToDate {
    public static void main(String[] args) throws ParseException {
//        String str = "2022-03-02";
//        SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
//        Date birthDate = format.parse(str);
//        String s = birthDate.toString();
//        System.out.println("最后转换出来的时间：" + s);

        String oldDateString = "2022-03-02";
        String newDateString;

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date d = sdf.parse(oldDateString);
        sdf.applyPattern("dd/MM/yyyy");
        newDateString = sdf.format(d);
        System.out.println("最后转换出来的时间：" + newDateString);
        System.out.println("最后转换出来的时间：" + System.currentTimeMillis());
    }
}
